
PRINTLN_DEBUG proc far
	push AX

	MOV AL,10
	CALL FAR PTR PRINT_CHAR
	MOV AL,13
	CALL FAR PTR PRINT_CHAR

	pop AX
	ret
PRINTLN_DEBUG endp

PRINT_AL_DEBUG proc far
	push CX
	push BX
	push DS
	push SI

	MOV	BX,DEBUG_SEG	;initialize data segment register
	MOV	DS,BX

	MOV	CX,16 ;length of the debug msg
	MOV	SI,00H ;use SI as a counter

	MOV BX,AX ;store value of AX in BX 

	PRINT_DEBUG_MSG_AL_LOOP:
		mov al,ds:DEBUG_AL[SI]
		INC	SI
		CALL FAR PTR PRINT_CHAR
	loop PRINT_DEBUG_MSG_AL_LOOP
	
	mov AX,BX ;restore value of AX
	CALL FAR PTR PRINT_2HEX
	mov AX,BX ;restore value of AX

	pop SI
	pop DS
	pop BX
	pop CX
	RET
PRINT_AL_DEBUG endp

PRINT_T1_PERIOD_DEBUG proc far
	push CX
	push BX
	push DS
	push SI

	MOV	BX,DEBUG_SEG	;initialize data segment register
	MOV	DS,BX

	MOV	CX,13 ;length of the debug msg
	MOV	SI,00H ;use SI as a counter

	MOV BX,AX ;store value of AX in BX 

	PRINT_T1_PERIOD_DEBUG_LOOP:
		mov al,ds:DEBUG_T1[SI]; 
		INC	SI
		CALL FAR PTR PRINT_CHAR
	loop PRINT_T1_PERIOD_DEBUG_LOOP
	
	mov AX,BX ;restore value of AX
	CALL FAR PTR PRINT_2HEX

	pop SI
	pop DS
	pop BX
	pop CX
	RET
PRINT_T1_PERIOD_DEBUG endp

PRINT_T2_PERIOD_DEBUG proc far
	push CX
	push BX
	push DS
	push SI

	MOV	BX,DEBUG_SEG	;initialize data segment register
	MOV	DS,BX

	MOV	CX,13 ;length of the debug msg
	MOV	SI,00H ;use SI as a counter

	MOV BX,AX ;store value of AX in BX 

	PRINT_T2_PERIOD_DEBUG_LOOP:
		mov al,ds:DEBUG_T2[SI]; 
		INC	SI
		CALL FAR PTR PRINT_CHAR
	loop PRINT_T2_PERIOD_DEBUG_LOOP
	
	mov AX,BX ;restore value of AX
	CALL FAR PTR PRINT_2HEX

	pop SI
	pop DS
	pop BX
	pop CX
	RET
PRINT_T2_PERIOD_DEBUG endp

PRINT_PRIORITY_CHECK_MSG_DEBUG proc far
	push CX
	push BX
	push DS
	push SI

	MOV	BX,DEBUG_SEG	;initialize data segment register
	MOV	DS,BX

	MOV	CX,32 ;length of the debug msg
	MOV	SI,00H ;use SI as a counter

	MOV BX,AX ;store value of AX in BX 

	PRINT_PRIORITY_CHECK_MSG_DEBUG_LOOP:
		mov al,ds:DEBUG_PRIORITY[SI]; 
		INC	SI
		CALL FAR PTR PRINT_CHAR
	loop PRINT_PRIORITY_CHECK_MSG_DEBUG_LOOP
	
	mov AX,BX ;restore value of AX

	pop SI
	pop DS
	pop BX
	pop CX
	RET
PRINT_PRIORITY_CHECK_MSG_DEBUG endp

PRINT_DEQUEUE_MSG_DEBUG proc far
	push CX
	push BX
	push DS
	push SI

	MOV	BX,DEBUG_SEG	;initialize data segment register
	MOV	DS,BX

	MOV	CX,11 ;length of the debug msg
	MOV	SI,00H ;use SI as a counter

	MOV BX,AX ;store value of AX in BX 

	PRINT_DEQUEUE_MSG_DEBUG_LOOP:
		mov al,ds:DEBUG_DEQUEUE[SI]
		INC	SI
		CALL FAR PTR PRINT_CHAR
	loop PRINT_DEQUEUE_MSG_DEBUG_LOOP
	
	mov AX,BX ;restore value of AX
	CALL FAR PTR PRINT_2HEX
	mov AX,BX ;restore value of AX

	pop SI
	pop DS
	pop BX
	pop CX
	RET
PRINT_DEQUEUE_MSG_DEBUG endp

PRINT_KEYPAD_INPUT_DEBUG proc far
	push CX
	push BX
	push DS
	push SI

	MOV	BX,DEBUG_SEG	;initialize data segment register
	MOV	DS,BX

	MOV	CX,16 ;length of the debug msg
	MOV	SI,00H ;use SI as a counter

	MOV BX,AX ;store value of AX in BX 

	PRINT_KEYPAD_INPUT_DEBUG_LOOP:
		mov al,ds:DEBUG_KEYPAD_INPUT[SI]
		INC	SI
		CALL FAR PTR PRINT_CHAR
	loop PRINT_KEYPAD_INPUT_DEBUG_LOOP
	
	mov AX,BX ;restore value of AX
	CALL FAR PTR PRINT_2HEX
	mov AX,BX ;restore value of AX

	pop SI
	pop DS
	pop BX
	pop CX
	RET
PRINT_KEYPAD_INPUT_DEBUG endp

;delay 1s = 16,000,000 clock cycles
fake_process_delay_debug proc far
;	mov CX,0064h ;100 times
	mov CX,10
delay_l1:
	;delay 10ms = 160,000 clock cycles
	mov BX,50	;7272 dec --> total=22*7272=159,984
	delay_l2:	
		nop		; 3 clocks
		dec BX	; 3 clocks
	jnz delay_l2; 16 clocks
	dec CX	;3 clocks cycles
jnz delay_l1 ;16 clocks cycles
	ret
fake_process_delay_debug endp	
